#include "api.h"

#include "service/service.h"

namespace OHOS {
namespace SmartServe {

bool RegisterModelCreator(std::unique_ptr<ModelCreator> creator)
{
    auto service = Service::Instance();
    std::unique_lock<std::mutex> lock(service->msMgmtMutex_);
    return service->modelManager_.Register(std::move(creator));
}

bool UnRegisterModelCreator(const std::string& name)
{
    auto service = Service::Instance();
    std::unique_lock<std::mutex> lock(service->msMgmtMutex_);
    return service->modelManager_.UnRegister(name);
}

bool RegisterSessionCreator(std::unique_ptr<SessionCreator> creator)
{
    auto service = Service::Instance();
    std::unique_lock<std::mutex> lock(service->msMgmtMutex_);
    return service->sessionManager_.Register(std::move(creator));
}

bool UnRegisterSessionCreator(const std::string& name)
{
    auto service = Service::Instance();
    std::unique_lock<std::mutex> lock(service->msMgmtMutex_);
    return service->sessionManager_.UnRegister(name);
}

} // namespace SmartServe
} // namespace OHOS